export class GameData {


    public static _Instance: GameData = null;

    public static Inst(): GameData {

        if (!GameData._Instance) {
            GameData._Instance = new GameData()
        }
        return GameData._Instance;

    }


    public m_nRoomid: number = 0;          //房间id
    public m_nUserid: number = 0;          //self userid
    public m_vPlayerName = null;           //玩家姓名{userid：name}
    public m_nHostUserid: number;          //当前的主持人
    public m_nCurRoomMasterid: number = 0; //当前所在房间的主人；
    public m_bstartGame: boolean = false;  //是否开始游戏


    public GetGamePlayerCount() {
        if (!this.m_vPlayerName) return 0;
        return Object.keys(this.m_vPlayerName).length
    }


    public checkIsHost() {

        return this.m_nHostUserid === this.m_nUserid;
    }

    public GetHostName() {

        return this.m_vPlayerName[this.m_nHostUserid];
    }

    public cheakRoomHolder() {


        return this.m_nCurRoomMasterid === this.m_nUserid;
    }

}